/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}


/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

	module.exports = __webpack_require__(1);


/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

	'use strict';

	__webpack_require__(2);

/***/ }),
/* 2 */
/***/ (function(module, exports) {

	'use strict';

	/*{
	  let ajax=function(callback){
	    console.log("start");
	    setTimeout(function(){
	      callback&&callback.call()
	    },1000);
	  }
	  ajax(function(){
	    console.log('timeout1');
	  })
	}
	{
	  let ajax=function(){
	    console.log('zhiixng2');
	    return new Promise(function(resolve,reject){
	      setTimeout(function(){
	        resolve()
	      },1000)
	    })
	  };
	  ajax().then(function(){
	    console.log('promise','timeout2');
	  })
	}*/
	/*{
	  let ajax=function(){
	    console.log('zhiixng3');
	    return new Promise(function(resolve,reject){
	      setTimeout(function(){
	        resolve()
	      },1000)
	    })
	  };

	  ajax().then(function(){
	    return new Promise(function(resolve,reject){
	      setTimeout(function(){
	        resolve()
	      },2000)
	    })
	  }).then(function(){
	    console.log('timeout3');
	  })
	}*/
	/*{
	  let ajax=function(num){
	    console.log('zhiixng4');
	    return  new Promise(function(resolve,reject){
	      if (num>5) {
	        resolve();
	      } else {
	        throw new Error('error');
	      }
	    })
	  }

	  ajax(3).then(function(){
	    console.log("log",3);
	  }).catch(function(err){
	    console.log('catch',err)
	  })
	}*/

	{
	  var loadImg = function loadImg(src) {
	    return new Promise(function (resolve, reject) {
	      var img = document.createElement('img');
	      img.src = src;
	      img.onload = function () {
	        resolve(img);
	      };
	      img.onerror = function (err) {
	        reject(err);
	      };
	    });
	  };

	  var showImgs = function showImgs(imgs) {
	    imgs.forEach(function (img) {
	      document.body.appendChild(img);
	    });
	  };

	  Promise.all([loadImg('https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/logo_white_fe6da1ec.png'), loadImg('http://i4.buimg.com/56751/df1ef0720bea6832.png'), loadImg('http://i4.buimg.com/56751/df1ef0720bea6833.png')]).then(showImgs);
	}

	{
	  var _loadImg = function _loadImg(src) {
	    return new Promise(function (resolve, reject) {
	      var img = document.createElement('img');
	      img.src = src;
	      img.onload = function () {
	        resolve(img);
	      };
	      img.onerror = function (err) {
	        reject(err);
	      };
	    });
	  };

	  var _showImgs = function _showImgs(img) {
	    var p = document.createElement('p');
	    p.appendChild(img);
	    document.body.appendChild(p);
	  };

	  Promise.race([_loadImg('https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=1404110873,1552586879&fm=80&w=179&h=119&img.JPEG'), _loadImg('https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/logo_white_fe6da1ec.png'), _loadImg('http://i4.buimg.com/56751/df1ef0720bea6833.png')]).then(_showImgs);
	}

/***/ })
/******/ ]);